#include "GlobalDefinition.h"
#include "DataDefinition.h"
#include <string>
#include <fstream>
#include <iostream>

using namespace std;
#pragma once

typedef struct tagTime
{
	char szTime[20];

	/**
	* A constructor.
	*/
	tagTime()
	{
		memset(szTime,0,20);
	}
}Time;

class FileBase
{
public:
	FileBase(string p_strFilePath, const unsigned int p_uiBufferSize);
	void SetFileFullPath(string p_strFilePath);
	string GetFileDir();
	virtual bool Process();
	virtual ~FileBase();

protected:
	bool OpenFile();
	bool CloseFile();
	bool IsFileExist();
	void GetDBFTime(Time& p_stTime, int p_iType);
	void GetDBFDate(Time& p_stTime, int p_iType);
	void GetMonthDay(string &p_strMonth, bool p_bFillBlankMonth, string &p_strDay, bool p_bFillBlankDay);

protected:
	char* m_pszBuffer;
	unsigned int m_uiBufferSize;
	unsigned int m_uiFileLength;

private:
	string m_strFilePath;
	ifstream m_cFileStream;
};